package com.rongshu.view.userInfo.presenter;

import android.content.Context;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.base.mvp.BasePresenter;
import com.rongshu.view.userInfo.entity.Province;
import com.rongshu.view.userInfo.iview.InlandView;

import rx.Subscriber;
import rx.functions.Action0;

public class InlandPresenter extends BasePresenter<InlandView> {

    public InlandPresenter(Context context) {
        super(context);
    }

    /**
     *获取省份
     */
    public void getChinaAddr(String rnd, String sign) {
        RetorfitService.getChinaAddr(rnd, sign)
                .doOnSubscribe(new Action0() {
                    @Override
                    public void call() {

                    }
                })
                .subscribe(new Subscriber<Province>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(Province province) {
                        if (getView() != null) {
                            getView().onChinaAddr(province);
                        }
                    }
                });
    }
}
